package com.xlh.dto.courseTest.experiment;

import cn.hutool.core.util.NumberUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author sy
 * 实验判定统计
 */
@ApiModel("实验判定通过统计")
@Data
public class ExperimentChapterStatisticsPassDTO {

    @ApiModelProperty(" 未通过学生总数 ")
    private Integer noPassUserCount;

    @ApiModelProperty(" 通过学生总数 ")
    private Integer passUserCount;

    @ApiModelProperty(" 通过学生姓名 ")
    private List<String> passUsers;

    @ApiModelProperty(" 未通过学生统计 ")
    private List<String> noPassUsers;

    @ApiModelProperty(" 通过率 ")
    private Double passingRate;



    public void setPassUsers(List<String> passUsers) {
        this.passUsers = passUsers;
        this.passUserCount = passUsers.size();
    }

    public void setNoPassUsers(List<String> noPassUsers) {
        this.noPassUsers = noPassUsers;
        this.noPassUserCount = noPassUsers.size();
    }

    /**
     * 计算出通过率
     */
    public void completePassingRate(){

        passingRate = NumberUtil.mul(NumberUtil.div(Double.valueOf(passUserCount) ,Double.valueOf(noPassUserCount + passUserCount),2), 100) ;
    }


}
